package com.bwie.controller;
import com.bwie.pojo.User;
import com.bwie.service.Impl.UserServiceImpl;
import com.bwie.service.UserService;
import com.bwie.utils.R;
import com.bwie.vo.LoginFromVo;
import com.bwie.vo.SendPhoneCodeVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

/**
* (t_user)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/user/user")
public class UserController {
/**
* 服务对象
*/
    @Autowired
    private UserService userService;

    /**
     * 获取图片验证码
     */
    @GetMapping("/imageCode")
    public void imageCode(){
        userService.imageCode();
    }

    /**
     * 获取手机号验证码
     * @param sendPhoneCodeVo
     * @return
     */
    @PostMapping("/sendPhoneCode")
    public R sendPhoneCode(
            @RequestBody SendPhoneCodeVo sendPhoneCodeVo
            ){
        return userService.sendPhoneCode(sendPhoneCodeVo);
    }

    /**
     * 登录
     * @param loginFromVo
     * @return
     */
    @PostMapping("/login")
    public R login(
            @RequestBody LoginFromVo loginFromVo
            ){
        return userService.login(loginFromVo);
    }

    /**
     * 文件上传
     * @param file
     * @return
     */
    @PostMapping("/uploadFile")
    public R uploadFile(
            @RequestPart("file")MultipartFile file
            ){
        return userService.uploadFile(file);
    }

}
